package com.xiaozhen.blog.utils;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @create 2023-05-23 11:29
 */
@Component
public class RabbitMQListener {
//    @RabbitListener(queues = "boot_queue")
//    public void ListenerQueue(String msg){
//        System.out.println("消费者接收到信息："+msg);
//    }

    @RabbitListener(queues = "boot_queue")
    public void ListenerQueue(String msg) throws InterruptedException {
        System.out.println("消费者1接收到信息："+msg);
        Thread.sleep(20);
    }

    @RabbitListener(queues = "boot_queue")
    public void ListenerQueue2(String msg) throws InterruptedException {
        System.err.println("消费者2接收到信息："+msg);
        Thread.sleep(200);
    }

}
